home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / mbyte.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  47.8 KB  |  1,188 lines

  1. *mbyte.txt*     For Vim version 6.0.  Last change: 2001 Sep 24
  2.  
  3.  
  4.           VIM REFERENCE MANUAL      by Bram Moolenaar et al.
  5.  
  6.  
  7. Multi-byte support                *multibyte* *multi-byte*
  8.                         *Chinese* *Japanese* *Korean*
  9. This is about editing text in languages which have many characters that can
  10. not be represented using one byte (one octet).  Examples are Chinese, Japanese
  11. and Korean.  Unicode is also covered here.
  12.  
  13. For an introduction to the most common features, see |usr_45.txt| in the user
  14. manual.
  15. For changing the language of messages and menus see |mlang.txt|.
  16.  
  17. {not available when compiled without the +multi_byte feature}
  18.  
  19.  
  20. 1.  Getting started            |mbyte-first|
  21. 2.  Locale                |mbyte-locale|
  22. 3.  Encoding                |mbyte-encoding|
  23. 4.  Using a terminal            |mbyte-terminal|
  24. 5.  Fonts on X11            |mbyte-fonts-X11|
  25. 6.  Fonts on MS-Windows            |mbyte-fonts-MSwin|
  26. 7.  Input on X11            |mbyte-XIM|
  27. 8.  Input on MS-Windows            |mbyte-IME|
  28. 9.  Input with a keymap            |mbyte-keymap|
  29. 10. Using UTF-8                |mbyte-utf8|
  30. 11. Overview of options            |mbyte-options|
  31.  
  32. ==============================================================================
  33. 1. Getting started                    *mbyte-first*
  34.  
  35. This is a summary of the multibyte features in Vim.  If you are lucky it works
  36. as described and you can start using Vim without much trouble.  If something
  37. doesn't work you will have to read the rest.  Don't be surprised if it takes
  38. quite a bit of work and experimenting to make Vim use all the multi-byte
  39. features.  Unfortunately, every system has its own way to deal with multibyte
  40. languages and it is quite complicated.
  41.  
  42.  
  43. COMPILING
  44.  
  45. If you already have a compiled Vim program, check if the |+multi_byte| feature
  46. is included.  The |:version| command can be used for this.
  47.  
  48. If +multi_byte is not included, you should compile Vim with "big" features.
  49. You can further tune what features are included.  See the INSTALL files in the
  50. source directory.
  51.  
  52.  
  53. LOCALE
  54.  
  55. First of all, you must make sure your current locale is set correctly.  If
  56. your system has been installed to use the language, it probably works right
  57. away.  If not, you can often make it work by setting the $LANG environment
  58. variable in your shell: >
  59.  
  60.     setenv lang ja_JP.EUC
  61.  
  62. Unfortunately, the name of the locale depends on your system.  Japanese might
  63. also be called "ja_JP.EUCjp" or just "ja".  To see what is currently used: >
  64.  
  65.     :language
  66.  
  67. To change the locale inside Vim use: >
  68.  
  69.     :language ja_JP.EUC
  70.  
  71. Vim will give an error message if this doesn't work.  This is a good way to
  72. experiment and find the locale name you want to use.  But it's always better
  73. to set the locale in the shell, so that it is used right from the start.
  74.  
  75. See |mbyte-locale| for details.
  76.  
  77.  
  78. ENCODING
  79.  
  80. If your locale works properly, Vim will try to set the 'encoding' option
  81. accordingly.  If this doesn't work you can overrule its value: >
  82.  
  83.     :set encoding=utf-8
  84.  
  85. See |encoding-values| for a list of acceptable values.
  86.  
  87. The result is that all the text that is used inside Vim will be in this
  88. encoding.  Not only the text in the buffers, but also in registers, variables,
  89. etc.  This also means that changing the value of 'encoding' makes the existing
  90. text invalid!  The text doesn't change, but it will be displayed wrong.
  91.  
  92. You can edit files in another encoding than what 'encoding' is set to.  Vim
  93. will convert the file when you read it and convert it back when you write it.
  94. See 'fileencoding', 'fileencodings' and |++enc|.
  95.  
  96.  
  97. DISPLAY AND FONTS
  98.  
  99. If you are working in a terminal (emulator) you must make sure it accepts the
  100. same encoding as which Vim is working with.  If this is not the case, you can
  101. use the 'termencoding' option to make Vim convert text automatically.
  102.  
  103. For the GUI you must select fonts that work with the current 'encoding'.  This
  104. is the difficult part.  It depends on the system you are using, the locale and
  105. a few other things.  See the chapters on fonts: |mbyte-fonts-X11| for
  106. X-Windows and |mbyte-fonts-MSwin| for MS-Windows.
  107.  
  108. For X11 you can set the 'guifontset' option to a list of fonts that together
  109. cover the characters that are used.  Example for Korean: >
  110.  
  111.     :set guifontset=k12,r12
  112.  
  113. Alternatively, you can set 'guifont' and 'guifontwide'.  'guifont' is used for
  114. the single-width characters, 'guifontwide' for the double-width characters.
  115. Thus the 'guifontwide' font must be exactly twice as wide as 'guifont'.
  116. Example for UTF-8: >
  117.  
  118.     :set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
  119.     :set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1
  120.  
  121. You can also set 'guifont' alone, Vim will try to find a matching
  122. 'guifontwide' for you.
  123.  
  124.  
  125. INPUT
  126.  
  127. There are several ways to enter multi-byte characters:
  128. - For X11 XIM can be used.  See |XIM|.
  129. - For MS-Windows IME can be used.  See |IME|.
  130. - For all systems keymaps can be used.  See |mbyte-keymap|.
  131.  
  132. The options 'iminsert', 'imsearch' and 'imcmdline' can be used to chose
  133. the different input medhods or disable them temporarily.
  134.  
  135. ==============================================================================
  136. 2.  Locale                        *mbyte-locale*
  137.  
  138. The easiest setup is when your whole system uses the locale you want to work
  139. in.  But it's also possible to set the locale for one shell you are working
  140. in, or just use a certain locale inside Vim.
  141.  
  142.  
  143. WHAT IS A LOCALE?                    *locale*
  144.  
  145. There are many of languages in the world.  And there are different cultures
  146. and environments at least as much as the number of languages.    A linguistic
  147. environment corresponding to an area is called "locale".  This includes
  148. information about the used language, the charset, collating order for sorting,
  149. date format, currency format and so on.  For Vim only the language and charset
  150. really matter.
  151.  
  152. You can only use a locale if your system has support for it.  Some systems
  153. have only a few locales, especially in the USA.  The language which you want
  154. to use may not be on your system.  In that case you might be able to install
  155. it as an extra package.  Check your system documentation for how to do that.
  156.  
  157. The location in which the locales are installed varies from system to system.
  158. For example, "/usr/share/locale" or "/usr/lib/locale".  See your system's
  159. setlocale() man page.
  160.  
  161. Looking in these directories will show you the exact name of each locale.
  162. Mostly upper/lowercase matters, thus "ja_JP.EUC" and "ja_jp.euc" are
  163. different.  Some systems have a locale.alias file, which allows translation
  164. from a short name like "nl" to the full name "nl_NL.ISO_8859-1".
  165.  
  166. Note that X-windows has its own locale stuff.  And unfortunately uses locale
  167. names different from what is used elsewhere.  This is confusing!  For Vim it
  168. matters what the setlocale() function uses, which is generally NOT the
  169. X-windows stuff.  You might have to do some experiments to find out what
  170. really works.
  171.  
  172.                             *locale-name*
  173. The (simplified) format of |locale| name is:
  174.  
  175.     language
  176. or    language_territory
  177. or    language_territory.codeset
  178.  
  179. Territory means the country (or part of it), codeset means the |charset|.  For
  180. example, the locale name "ja_JP.eucJP" means:
  181.     ja    the language is Japanese
  182.     JP    the country is Japan
  183.     eucJP    the codeset is EUC-JP
  184. But it also could be "ja", "ja_JP.EUC", "ja_JP.ujis", etc.  And unfortunately,
  185. the locale name for a specific language, territory and codeset is not unified
  186. and depends on your system.
  187.  
  188. Examples of locale name:
  189.     charset        language          locale name ~
  190.     GB2312        Chinese (simplified)  zh_CN.EUC, zh_CN.GB2312
  191.     Big5        Chinese (traditional) zh_TW.BIG5, zh_TW.Big5
  192.     CNS-11643        Chinese (traditional) zh_TW
  193.     EUC-JP        Japanese          ja, ja_JP.EUC, ja_JP.ujis, ja_JP.eucJP
  194.     Shift_JIS        Japanese          ja_JP.SJIS, ja_JP.Shift_JIS
  195.     EUC-KR        Korean          ko, ko_KR.EUC
  196.  
  197.  
  198. USING A LOCALE
  199.  
  200. To start using a locale for the whole system, see the documentation of your
  201. system.  Mostly you need to set it in a configuration file in "/etc".
  202.  
  203. To use a locale in a shell, set the $LANG environment value.  When you want to
  204. use Korean and the |locale| name is "ko", do this:
  205.  
  206.     sh:    export LANG=ko
  207.     csh:   setenv LANG ko
  208.  
  209. You can put this in your ~/.profile or ~/.cshrc file to always use it.
  210.  
  211. To use a locale in Vim only, use the |:language| command: >
  212.  
  213.     :language ko
  214.  
  215. Put this in your ~/.vimrc file to use it always.
  216.  
  217. Or specify $LANG when starting Vim:
  218.  
  219.    sh:    LANG=ko vim {vim-arguments}
  220.    csh:      env LANG=ko vim {vim-arguments}
  221.  
  222. You could make a small shell script for this.
  223.  
  224. ==============================================================================
  225. 3.  Encoding                *mbyte-encoding*
  226.  
  227. Vim uses the 'encoding' option to specify how characters identified and
  228. encoded when they are used inside Vim.  This applies to all the places where
  229. text is used, including buffers (files loaded into memory), registers and
  230. variables.
  231.  
  232.                             *charset* *codeset*
  233. Charset is another name for encoding.  There are subtle differences, but these
  234. don't matter when using Vim.  "codeset" is another similar name.
  235.  
  236. Each characters is encoded as one or more bytes.  When all characters are
  237. encoded with one byte, we call this a single-byte encoding.  The most often
  238. used one is called "latin1".  This limits the number of characters to 256.
  239. Some of these are control characters, thus even less can be used for text.
  240.  
  241. When some characters use two or more bytes, we call this a multi-byte
  242. encoding.  This allows using much more than 256 characters, which is required
  243. for most East Asian languages.
  244.  
  245. Most multi-byte encodings use one byte for the first 127 characters.  These
  246. are equal to ASCII, which makes it easy to exchange plain-ASCII text, no
  247. matter what language is used.  Thus you might see the right text even when the
  248. encoding was set wrong.
  249.  
  250.                             *encoding-names*
  251. Vim can use many different character encodings.  There are three major groups:
  252.  
  253. 1   8bit    Single-byte encodings, 256 different characters.  Mostly used
  254.         in USA and Europe.  Example: ISO-8859-1 (Latin1).  All
  255.         characters occupy one screen cell only.
  256.  
  257. 2   2byte    Double-byte encodings, over 10000 different characters.
  258.         Mostly used in Asian countries.  Example: euc-kr (Korean)
  259.         The number of screen cells is equal to the number of bytes
  260.         (except for euc-jp when the first byte is 0x8e).
  261.  
  262. u   Unicode    Universal encoding, can replace all others.  ISO 10646.
  263.         Millions of different characters.  Example: UTF-8.  The
  264.         relation between bytes and screen cells is complex.
  265.  
  266. Other encodings cannot be used by Vim internally.  But files in other
  267. encodings can be edited by using conversion, see 'fileencoding'.
  268. Note that all encodings must use ASCII for the characters up to 128 (except
  269. when compiled for EBCDIC).
  270.  
  271. Supported 'encoding' values are:            *encoding-values*
  272. 1   latin1    8-bit characters (ISO 8859-1)
  273. 1   iso-8859-n    ISO_8859 variant (n = 2 to 15)
  274. 1   koi8-r    Russian
  275. 1   koi8-u    Ukrainian
  276. 1   8bit-{name} any 8-bit encoding (Vim specific name)
  277. 1   cp{number}    MS-Windows: any installed single-byte codepage
  278. 2   cp932    Japanese (Windows only)
  279. 2   euc-jp    Japanese (Unix only)
  280. 2   sjis    Japanese (Unix only)
  281. 2   cp949    Korean (Unix and Windows)
  282. 2   euc-kr    Korean (Unix only)
  283. 2   cp936    simplified Chinese (Windows only)
  284. 2   euc-cn    simplified Chinese (Unix only)
  285. 2   cp950    traditional Chinese (on Unix alias for big5)
  286. 2   big5    traditional Chinese (on Windows alias for cp950)
  287. 2   euc-tw    traditional Chinese (Unix only)
  288. 2   2byte-{name} Unix: any double-byte encoding (Vim specific name)
  289. 2   cp{number}    MS-Windows: any installed double-byte codepage
  290. u   utf-8    32 bit UTF-8 encoded Unicode (ISO/IEC 10646-1)
  291. u   ucs-2    16 bit UCS-2 encoded Unicode (ISO/IEC 10646-1)
  292. u   ucs-2le    like ucs-2, little endian
  293. u   utf-16    ucs-2 extended with double-words for more characters
  294. u   utf-16le    like utf-16, little endian
  295. u   ucs-4    32 bit UCS-4 encoded Unicode (ISO/IEC 10646-1)
  296. u   ucs-4le    like ucs-4, little endian
  297.     cp{number}    MS-Windows: any installed codepage which is single-byte or
  298.         double-byte
  299.  
  300. The {name} can be any encoding name that your system supports.  It is passed
  301. to iconv() to convert between the encoding of the file and the current locale.
  302. For MS-Windows "cp{number}" means using codepage {number}.
  303. Examples: >
  304.         :set encoding=8bit-cp1252
  305.         :set encoding=2byte-cp932
  306. <
  307. Several aliases can be used, they are translated to one of the names above.
  308. An incomplete list:
  309.  
  310. 1   ansi    same as latin1 (obsolete, for backward compatibility)
  311. 2   japan    Japanese: on Unix "euc-jp", on MS-Windows cp932
  312. 2   korea    Korean: on Unix "euc-kr", on MS-Windows cp949
  313. 2   prc        simplified Chinese: on Unix "chinese", on MS-Windows cp936
  314. 2   taiwan    traditional Chinese: on Unix "euc-tw", on MS-Windows cp950
  315. u   utf8    same as utf-8
  316. u   unicode    same as ucs-2
  317. u   ucs2be    same as ucs-2 (big endian)
  318. u   ucs-2be    same as ucs-2 (big endian)
  319. u   ucs-4be    same as ucs-4 (big endian)
  320.  
  321. For the UCS codes the byte order matters.  This is tricky, use UTF-8 whenever
  322. you can.  The default is to use big-endian (most significant byte comes
  323. first):
  324.         name    bytes        char ~
  325.         ucs-2          11 22        1122
  326.         ucs-2le          22 11        1122
  327.         ucs-4    11 22 33 44    11223344
  328.         ucs-4le    44 33 22 11    11223344
  329.  
  330. On MS-Windows systems you often want to use "ucs-2le", because it uses little
  331. endian UCS-2.
  332.  
  333. There are a few encodings which are similar, but exactly the same.  Vim treats
  334. them as if they were different encodings, so that conversion will be done when
  335. needed.  You might want to use the similar name to avoid conversion or when
  336. conversion is not possible:
  337.  
  338.     cp932, shift-jis, sjis
  339.     cp936, euc-cn
  340.  
  341.                             *encoding-table*
  342. Normally 'encoding' is equal to your current locale and 'termencoding' is
  343. empty.  This means that your keyboard and display work with characters encoded
  344. in your current locale, and Vim uses the same characters internally.
  345.  
  346. You can make Vim use characters in a different encoding by setting the
  347. 'encoding' option to a different value.  Since the keyboard and display still
  348. use the current locale, conversion needs to be done.  The 'termencoding' then
  349. takes over the value of the current locale, so Vim converts between 'encoding'
  350. and 'termencoding'.  Example: >
  351.     :let &termencoding = &encoding
  352.     :set encoding=utf-8
  353.  
  354. However, not all combinations of values are possible.  The table below tells
  355. you how each of the nine combinations works.  This is further restricted by
  356. not all conversions being possible, iconv() being present, etc.  Since this
  357. depends on the system used, no detailed list can be given.
  358.  
  359. ('tenc' is the short name for 'termencoding' and 'enc' short for 'encoding')
  360.  
  361. 'tenc'        'enc'    remark ~
  362.  
  363.  8bit        8bit    Works.  When 'termencoding' is different from
  364.             'encoding' typing and displaying may be wrong for some
  365.             characters, Vim does NOT perform conversion (set
  366.             'encoding' to "utf-8" to get this).
  367.  8bit      2byte    MS-Windows: works for all codepages installed on your
  368.             system; you can only type 8bit characters;
  369.             Other systems: does NOT work.
  370.  8bit       Unicode    Works, but you can only type 8bit characters; in a
  371.             terminal you can only see 8bit characters; the GUI can
  372.             show all characters that the 'guifont' supports.
  373.  
  374.  2byte        8bit    Works, but typing non-ASCII characters might
  375.             be a problem.
  376.  2byte       2byte    MS-Windows: works for all codepages installed on your
  377.             system; typing characters might be a problem when
  378.             locale is different from 'encoding'.
  379.             Other systems: Only works when 'termencoding' is equal
  380.             to 'encoding', you might as well leave it empty.
  381.  2byte       Unicode    works, Vim will translate typed characters.
  382.  
  383.  Unicode    8bit    works (unusual)
  384.  Unicode    2byte    does NOT work
  385.  Unicode   Unicode    works very well (leaving 'termencoding' empty works
  386.             the same way, because all Unicode is handled
  387.             internally as UTF-8)
  388.  
  389. CONVERSION                        *charset-conversion*
  390.  
  391. Vim will automatically convert from one to another encoding in several places:
  392. - When reading a file and 'fileencoding' is different from 'encoding'
  393. - When writing a file and 'fileencoding' is different from 'encoding'
  394. - When displaying characters and 'termencoding' is different from 'encoding'
  395. - When reading input and 'termencoding' is different from 'encoding'
  396. - When displaying messages and the encoding used for LC_MESSAGES differs from
  397.   'encoding' (requires a gettext version that supports this).
  398. - When reading a Vim script where |:scriptencoding| is different from
  399.   'encoding'.
  400. - When reading or writing a |viminfo| file.
  401. Most of these require the |+iconv| feature.  Conversion for reading and
  402. writing files may also be specified with the 'charconvert' option.
  403.  
  404. Useful utilities for converting the charset:
  405.     All:        iconv
  406.     GNU iconv can convert most encodings.  Unicode is used as the
  407.     intermediate encoding, which allows conversion from and to all other
  408.     encodings.  See http://www.gnu.org/directory/libiconv.html.
  409.  
  410.     Japanese:        nkf
  411.     Nkf is "Network Kanji code conversion Filter".  One of the most unique
  412.     facility of nkf is the guess of the input Kanji code.  So, you don't
  413.     need to know what the inputting file's |charset| is.  When convert to
  414.     EUC-JP from ISO-2022-JP or Shift_JIS, simply do the following command
  415.     in Vim:
  416.         :%!nkf -e
  417.     Nkf can be found at:
  418.     http://www.sfc.wide.ad.jp/~max/FreeBSD/ports/distfiles/nkf-1.62.tar.gz
  419.  
  420.     Chinese:        hc
  421.     Hc is "Hanzi Converter".  Hc convert a GB file to a Big5 file, or Big5
  422.     file to GB file.  Hc can be found at:
  423.     ftp://ftp.cuhk.hk/pub/chinese/ifcss/software/unix/convert/hc-30.tar.gz
  424.  
  425.     Korean:        hmconv
  426.     Hmconv is Korean code conversion utility especially for E-mail. It can
  427.     convert between EUC-KR and ISO-2022-KR.  Hmconv can be found at:
  428.     ftp://ftp.kaist.ac.kr/pub/hangul/code/hmconv/hmconv1.0pl3
  429.  
  430.     Multilingual:   lv
  431.     Lv is a Powerful Multilingual File Viewer.  And it can be worked as
  432.     |charset| converter.  Supported |charset|: ISO-2022-CN, ISO-2022-JP,
  433.     ISO-2022-KR, EUC-CN, EUC-JP, EUC-KR, EUC-TW, UTF-7, UTF-8, ISO-8859
  434.     series, Shift_JIS, Big5 and HZ. Lv can be found at:
  435.     http://www.ff.iij4u.or.jp/~nrt/freeware/lv4493.tar.gz
  436.  
  437. ==============================================================================
  438. 4. Using a terminal                    *mbyte-terminal*
  439.  
  440. The GUI fully supports multi-byte characters.  It is also possible in a
  441. terminal, if the terminal supports the same encoding that Vim uses.  Thus this
  442. is less flexible.
  443.  
  444. For example, you can run Vim in a xterm with added multi-byte support and/or
  445. |XIM|.  Examples are kterm (Kanji term) and hanterm (for Korean), Eterm
  446. (Enlightened terminal) and rxvt.
  447.  
  448. If your terminal does not support the right encoding, you can set the
  449. 'termencoding' option.  Vim will then convert the typed characters from
  450. 'termencoding' to 'encoding'.  And displayed text will be converted from
  451. 'encoding' to 'termencoding'.  If the encoding supported by the terminal
  452. doesn't include all the characters that Vim uses, this leads to lost
  453. characters.  This may mess up the display.  If you use a terminal that
  454. supports Unicode, such as the xterm mentioned below, it should work just fine,
  455. since nearly every character set can be converted to Unicode without loss of
  456. information.
  457.  
  458.  
  459. UTF-8 IN XFREE86 XTERM                    *UTF8-xterm*
  460.  
  461. This is a short explanation of how to use UTF-8 character encoding in the
  462. xterm that comes with XFree86 by Thomas Dickey (text by Markus Kuhn).
  463.  
  464. Get the latest xterm version which has now UTF-8 support:
  465.  
  466.     http://www.clark.net/pub/dickey/xterm/xterm.tar.gz
  467.  
  468. Compile it with "./configure --enable-wide-chars ; make"
  469.  
  470. Also get the ISO 10646-1 version of various fonts, which is available on
  471.  
  472.     http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
  473.  
  474. and install the font as described in the README file.
  475.  
  476. Now start xterm with >
  477.  
  478.   xterm -u8 -fn -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
  479. or, for bigger character: >
  480.   xterm -u8 -fn -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1
  481.  
  482. and you will have a working UTF-8 terminal emulator. Try both >
  483.  
  484.    cat utf-8-demo.txt
  485.    vim utf-8-demo.txt
  486.  
  487. with the demo text that comes with ucs-fonts.tar.gz in order to see
  488. whether there are any problems with UTF-8 in your xterm.
  489.  
  490. For Vim you may need to set 'encoding' to "utf-8".
  491.  
  492. ==============================================================================
  493. 5.  Fonts on X11                    *mbyte-fonts-X11*
  494.  
  495. Unfortunately, using fonts in X11 is complicated.  The name of a single-byte
  496. font is a long string.  For multi-byte fonts we need several of these...
  497.  
  498. First of all, Vim only accepts fixed-width fonts for displaying text.  You
  499. cannot use proportionally spaced fonts.  This excludes many of the available
  500. (and nicer looking) fonts.  However, for menus and tooltips any font can be
  501. used.
  502.  
  503. Note that Display and Input are independent.  It is possible to see your
  504. language even though you have no input method for it.
  505.  
  506. You should get a default font for menus and tooltips that works, but it might
  507. be ugly.  Read the following to find out how to select a better font.
  508.  
  509.  
  510. X LOGICAL FONT DESCRIPTION (XLFD)
  511.                             *XLFD*
  512. XLFD is the X font name and contains the information about the font size,
  513. charset, etc.  The name is in this format:
  514.  
  515. FOUNDRY-FAMILY-WEIGHT-SLANT-WIDTH-STYLE-PIXEL-POINT-X-Y-SPACE-AVE-CR-CE
  516.  
  517. Each field means:
  518.  
  519. - FOUNDRY:  FOUNDRY field.  The company that created the font.
  520. - FAMILY:   FAMILY_NAME field.  Basic font family name.  (helvetica, gothic,
  521.         times, etc)
  522. - WEIGHT:   WEIGHT_NAME field.  How thick the letters are.  (light, medium,
  523.         bold, etc)
  524. - SLANT:    SLANT field.
  525.         r:  Roman (no slant
  526.         i:  Italic
  527.         o:  Oblique
  528.         ri: Reverse Italic
  529.         ro: Reverse Oblique
  530.         ot: Other
  531.         number:    Scaled font
  532. - WIDTH:    SETWIDTH_NAME field.  Width of characters.  (normal, condensed,
  533.         narrow, double wide)
  534. - STYLE:    ADD_STYLE_NAME field.  Extra info to describe font.  (Serif, Sans
  535.         Serif, Informal, Decorated, etc)
  536. - PIXEL:    PIXEL_SIZE field.  Height, in pixels, of characters.
  537. - POINT:    POINT_SIZE field.  Ten times height of characters in points.
  538. - X:        RESOLUTION_X field.  X resolution (dots per inch).
  539. - Y:        RESOLUTION_Y field.  Y resolution (dots per inch).
  540. - SPACE:    SPACING field.
  541.         p:  Proportional
  542.         m:  Monospaced
  543.         c:  CharCell
  544. - AVE:        AVERAGE_WIDTH field.  Ten times average width in pixels.
  545. - CR:        CHARSET_REGISTRY field.  The name of the charset group.
  546. - CE:        CHARSET_ENCODING field.  The rest of the charset name.  For some
  547.         charsets, such as JIS X 0208, if this field is 0, code points has
  548.         the same value as GL, and GR if 1.
  549.  
  550. For example, in case of a 14 dots font corresponding to JIS X 0208, it is
  551. written like:
  552.     -misc-fixed-medium-r-normal--16-110-100-100-c-160-jisx0208.1990-0
  553.  
  554.  
  555. X FONTSET
  556.                         *fontset* *xfontset*
  557. A single-byte charset is typically associated with one font.  For multi-byte
  558. charsets a combination of fonts is often used.  This means that one group of
  559. characters are used from one font and another group from another font (which
  560. might be double wide).  This collection of fonts is called a fontset.
  561.  
  562. Which fonts are required in a fontset depends on the current locale.  X
  563. windows maintains a table of which groups of characters are required for a
  564. locale.  You have to specify all the fonts that a locale requires in the
  565. 'guifontset' option.
  566.  
  567. NOTE: The fontset always uses the current locale, even though 'encoding' may
  568. be set to use a different charset.  In that situation you might want to use
  569. 'guifont' and 'guifontwide' instead of 'guifontset'.
  570.  
  571. Example:
  572.     |charset| language            "groups of characters" ~
  573.     GB2312    Chinese (simplified)  ISO-8859-1 and GB 2312
  574.     Big5      Chinese (traditional) ISO-8859-1 and Big5
  575.     CNS-11643 Chinese (traditional) ISO-8859-1, CNS 11643-1 and CNS 11643-2
  576.     EUC-JP    Japanese            JIS X 0201 and JIS X 0208
  577.     EUC-KR    Korean            ISO-8859-1 and KS C 5601 (KS X 1001)
  578.  
  579. You can search for fonts using the xlsfonts command.  For example, when you're
  580. searching for a font for KS C 5601: >
  581.     xlsfonts | grep ksc5601
  582.  
  583. This is complicated and confusing.  You might want to consult the X-Windows
  584. documentation if there is something you don't understand.
  585.  
  586.                         *base_font_name_list*
  587. When you have found the names of the fonts you want to use, you need to set
  588. the 'guifontset' option.  You specify the list by concatenating the font names
  589. and putting a comma in between them.
  590.  
  591. For example, when you use the ja_JP.eucJP locale, this requires JIS X 0201
  592. and JIS X 0208.  You could supply a list of fonts that explicitly specifies
  593. the charsets, like: >
  594.  
  595.  :set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0,
  596.     \-misc-fixed-medium-r-normal--14-130-75-75-c-70-jisx0201.1976-0
  597.  
  598. Alternatively, you can supply a base font name list that omits the charset
  599. name, letting X-Windows select font characters required for the locale.  For
  600. example: >
  601.  
  602.  :set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140,
  603.     \-misc-fixed-medium-r-normal--14-130-75-75-c-70
  604.  
  605. Alternatively, you can supply a single base font name that allows X-Windows to
  606. select from all available fonts.  For example: >
  607.  
  608.  :set guifontset=-misc-fixed-medium-r-normal--14-*
  609.  
  610. Alternatively, you can specify alias names.  See the fonts.alias file in the
  611. fonts directory (e.g., /usr/X11R6/lib/X11/fonts/).  For example: >
  612.  
  613.  :set guifontset=k14,r14
  614. <
  615.                             *E253*
  616. Note that in East Asian fonts, the standard character cell is square.  When
  617. mixing a Latin font and an East Asian font, the East Asian font width should
  618. be twice the Latin font width.
  619.  
  620. If 'guifontset' is not empty, the "font" argument of the |:highlight| command
  621. is also interpreted as a fontset.  For example, you should use for
  622. highlighting: >
  623.     :hi Comment font=english_font,your_font
  624. If you use a wrong "font" argument you will get an error message.
  625. Also make sure that you set 'guifontset' before setting fonts for highlight
  626. groups.
  627.  
  628.  
  629. USING RESOURCE FILES
  630.  
  631. Instead of specifying 'guifontset', you can set X11 resources and Vim will
  632. pick them up.  This is only for people who know how X resource files work.
  633.  
  634. For Motif and Athena insert these three lines in your $HOME/.Xdefaults file:
  635.  
  636.     Vim.font: |base_font_name_list|
  637.     Vim*fontSet: |base_font_name_list|
  638.     Vim*fontList: your_language_font
  639.  
  640. Note: Vim.font is for text area.
  641.       Vim*fontSet is for menu.
  642.       Vim*fontList is for menu (for Motif GUI)
  643.  
  644. For example, when you are using Japanese and a 14 dots font, >
  645.  
  646.     Vim.font: -misc-fixed-medium-r-normal--14-*
  647.     Vim*fontSet: -misc-fixed-medium-r-normal--14-*
  648.     Vim*fontList: -misc-fixed-medium-r-normal--14-*
  649. <
  650. or: >
  651.  
  652.     Vim*font: k14,r14
  653.     Vim*fontSet: k14,r14
  654.     Vim*fontList: k14,r14
  655. <
  656. To have them take effect immediately you will have to do >
  657.  
  658.     xrdb -merge ~/.Xdefaults
  659.  
  660. Otherwise you will have to stop and restart the X server before the changes
  661. take effect.
  662.  
  663.  
  664. The GTK+ version of GUI Vim does not use .Xdefaults, use ~/.gtkrc instead.
  665. The default mostly works OK.  But for the menus you might have to change
  666. it.  Example: >
  667.  
  668.     style "default"
  669.     {
  670.         fontset="-*-*-medium-r-normal--14-*-*-*-c-*-*-*"
  671.     }
  672.     widget_class "*" style "default"
  673.  
  674. ==============================================================================
  675. 6.  Fonts on MS-Windows                *mbyte-fonts-MSwin*
  676.  
  677. The simplest is to use the font dialog to select fonts and try them out.  You
  678. can find this at the "Edit/Select Font..." menu.  Once you find a font name
  679. that works well you can use this command to see its name: >
  680.  
  681.     :set guifont
  682.  
  683. Then add a command to your |gvimrc| file to set 'guifont': >
  684.  
  685.     :set guifont=courier_new:h12
  686.  
  687. ==============================================================================
  688. 7.  Input on X11                *mbyte-XIM*
  689.  
  690. X INPUT METHOD (XIM) BACKGROUND            *XIM* *xim* *x-input-method*
  691.  
  692. XIM is an international input module for X.  There are two kind of structures,
  693. Xlib unit type and |IM-server| (Input-Method server) type.  |IM-server| type
  694. is suitable for complex input, such as CJK.
  695.  
  696. - IM-server
  697.                             *IM-server*
  698.   In |IM-server| type input structures, the input event is handled by either
  699.   of the two ways: FrontEnd system and BackEnd system.  In the FrontEnd
  700.   system, input events are snatched by the |IM-server| first, then |IM-server|
  701.   give the application the result of input.  On the other hand, the BackEnd
  702.   system works reverse order.  MS Windows adopt BackEnd system.  In X, most of
  703.   |IM-server|s adopt FrontEnd system.  The demerit of BackEnd system is the
  704.   large overhead in communication, but it provides safe synchronization with
  705.   no restrictions on applications.
  706.  
  707.   For example, there are xwnmo and kinput2 Japanese |IM-server|, both are
  708.   FrontEnd system.  Xwnmo is distributed with Wnn (see below), kinput2 can be
  709.   found at: ftp://ftp.sra.co.jp/pub/x11/kinput2/
  710.  
  711.   For Chinese, there's a great XIM server named "xcin", you can input both
  712.   Traditional and Simplified Chinese characters.  And it can accept other
  713.   locale if you make a correct input table.  Xcin can be found at:
  714.   http://xcin.linux.org.tw/
  715.  
  716. - Conversion Server
  717.                             *conversion-server*
  718.   Some system needs additional server: conversion server.  Most of Japanese
  719.   |IM-server|s need it, Kana-Kanji conversion server.  For Chinese inputting,
  720.   it depends on the method of inputting, in some methods, PinYin or ZhuYin to
  721.   HanZi conversion server is needed.  For Korean inputting, if you want to
  722.   input Hanja, Hangul-Hanja conversion server is needed.
  723.  
  724.   For example, the Japanese inputting process is divided into 2 steps.  First
  725.   we pre-input Hira-gana, second Kana-Kanji conversion.  There are so many
  726.   Kanji characters (6349 Kanji characters are defined in JIS X 0208) and the
  727.   number of Hira-gana characters are 76.  So, first, we pre-input text as
  728.   pronounced in Hira-gana, second, we convert Hira-gana to Kanji or Kata-Kana,
  729.   if needed.  There are some Kana-Kanji conversion server: jserver
  730.   (distributed with Wnn, see below) and canna. Canna can be found at:
  731.   ftp://ftp.nec.co.jp/pub/Canna/
  732.  
  733. There is a good input system: Wnn4.2.  Wnn 4.2 contains,
  734.     xwnmo (|IM-server|)
  735.     jserver (Japanese Kana-Kanji conversion server)
  736.     cserver (Chinese PinYin or ZhuYin to simplified HanZi conversion server)
  737.     tserver (Chinese PinYin or ZhuYin to traditional HanZi conversion server)
  738.     kserver (Hangul-Hanja conversion server)
  739. Wnn 4.2 can be found at:
  740.     ftp://ftp.FreeBSD.ORG/pub/FreeBSD/ports/distfiles/Wnn4.2.tar.gz
  741.  
  742.  
  743. - Input Style
  744.                             *xim-input-style*
  745.   When inputting CJK, there are four areas:
  746.       1. The area to display of the input while it is being composed
  747.       2. The area to display the currently active input mode.
  748.       3. The area to display the next candidate for the selection.
  749.       4. The area to display other tools.
  750.  
  751.   The third area is needed when converting.  For example, in Japanese
  752.   inputting, multiple Kanji characters could have the same pronunciation, so
  753.   a sequence of Hira-gana characters could map to a distinct sequence of Kanji
  754.   characters.
  755.  
  756.   The first and second areas are defined in international input of X with the
  757.   names of "Preedit Area", "Status Area" respectively.  The third and fourth
  758.   areas are not defined and are left to be managed by the |IM-server|.  In the
  759.   international input, four input styles have been defined using combinations
  760.   of Preedit Area and Status Area: |OnTheSpot|, |OffTheSpot|, |OverTheSpot|
  761.   and |Root|.
  762.  
  763.   Currently, GUI Vim support three style, |OverTheSpot|, |OffTheSpot| and
  764.   |Root|.
  765.  
  766. *.  on-the-spot                        *OnTheSpot*
  767.     Preedit Area and Status Area are performed by the client application in
  768.     the area of application.  The client application is directed by the
  769.     |IM-server| to display all pre-edit data at the location of text
  770.     insertion. The client registers callbacks invoked by the input method
  771.     during pre-editing.
  772. *.  over-the-spot                    *OverTheSpot*
  773.     Status Area is created in a fixed position within the area of application,
  774.     in case of Vim, the position is the additional status line.  Preedit Area
  775.     is made at present input position of application.  The input method
  776.     displays pre-edit data in a window which it brings up directly over the
  777.     text insertion position.
  778. *.  off-the-spot                    *OffTheSpot*
  779.     Preedit Area and Status Area are performed in the area of application, in
  780.     case of Vim, the area is additional status line.  The client application
  781.     provides display windows for the pre-edit data to the input method which
  782.     displays into them directly.
  783. *.  root-window                        *Root*
  784.     Preedit Area and Status Area are outside of the application.  The input
  785.     method displays all pre-edit data in a separate area of the screen in a
  786.     window specific to the input method.
  787.  
  788.  
  789. USING XIM            *multibyte-input* *E284* *E286* *E287* *E288*
  790.                 *E285* *E291* *E292* *E290* *ez4* *E289*
  791.  
  792. Note that Display and Input are independent.  It is possible to see your
  793. language even though you have no input method for it.  But when your Display
  794. method doesn't match your Input method, the text will be displayed wrong.
  795.  
  796.     Note: You can not use IM unless you specify 'guifontset'.
  797.           Therefore, Latin users, you have to also use 'guifontset'
  798.           if you use IM.
  799.  
  800. To input your language you should run the |IM-server| which supports your
  801. language and |conversion-server| if needed.
  802.  
  803. The next 3 lines should be put in your ~/.Xdefaults file.  They are common for
  804. all X applications which uses |XIM|.  If you already use |XIM|, you can skip
  805. this. >
  806.  
  807.     *international: True
  808.     *.inputMethod: your_input_server_name
  809.     *.preeditType: your_input_style
  810. <
  811. input_server_name    is your |IM-server| name (check your |IM-server|
  812.             manual).
  813. your_input_style    is one of |OverTheSpot|, |OffTheSpot|, |Root|.  See
  814.             also |xim-input-style|.
  815.  
  816. *international may not necessary if you use X11R6.
  817. *.inputMethod and *.preeditType are optional if you use X11R6.
  818.  
  819. For example, when you are using kinput2 as |IM-server|, >
  820.  
  821.     *international: True
  822.     *.inputMethod: kinput2
  823.     *.preeditType: OverTheSpot
  824. <
  825. When using |OverTheSpot|, GUI Vim always connects to the IM Server even in
  826. Normal mode, so you can input your language with commands like "f" and "r".
  827. But when using one of the other two methods, GUI Vim connects to the IM Server
  828. only if it is not in Normal mode.
  829.  
  830. If your IM Server does not support |OverTheSpot|, and if you want to use your
  831. language with some Normal mode command like "f" or "r", then you should use a
  832. localized xterm  or an xterm which supports |XIM|
  833.  
  834. If needed, you can set the XMODIFIERS environment variable:
  835.  
  836.     sh:  export XMODIFIERS="@im=input_server_name"
  837.     csh: setenv XMODIFIERS "@im=input_server_name"
  838.  
  839. For example, when you are using kinput2 as |IM-server| and sh, >
  840.  
  841.     export XMODIFIERS="@im=kinput2"
  842. <
  843.  
  844. FULLY CONTROLED XIM
  845.  
  846. You can fully control XIM, like with IME of MS-Windows (see |multibyte-ime|).
  847. This is currently only available for the GTK GUI.
  848.  
  849. Before using fully controled XIM, one setting is required.  Set the
  850. 'imactivatekey' option to the key that is used for the activation of the input
  851. method.  For example, when you are using kinput2 + canna as IM Server, the
  852. activation key is probably Shift+Space: >
  853.  
  854.     :set imactivatekey=S-space
  855.  
  856. See 'imactivatekey' for the format.
  857.  
  858. ==============================================================================
  859. 8.  Input on MS-Windows                    *mbyte-IME*
  860.  
  861. (Windows IME support)                *multibyte-ime* *IME*
  862.  
  863. {only works Windows GUI and compiled with the |+multi_byte_ime| feature}
  864.  
  865. To input multibyte characters on Windows, you have to use Input Method Editor
  866. (IME).  In process of your editing text, you must switch status (on/off) of
  867. IME many many many times.  Because IME with status on is hooking all of your
  868. key inputs, you cannot input 'j', 'k', or almost all of keys to Vim directly.
  869.  
  870. This |+multi_byte_ime| feature help this.  It reduce times of switch status of
  871. IME manually.  In normal mode, there are almost no need working IME, even
  872. editing multibyte text.  So exiting insert mode with ESC, Vim memorize last
  873. status of IME and force turn off IME.  When re-enter insert mode, Vim revert
  874. IME status to that momorized automatically.
  875.  
  876. This works on not only insert-normal mode, but also search-command input and
  877. replace mode.
  878.  
  879. Cursor color when IME or XIM is on                *CursorIM*
  880.     There is a little cute feature for IME.  Cursor can indicate status of IME
  881.     by changing its color.  Usually status of IME was indicated by little icon
  882.     at a corner of desktop (or taskbar).  It is not easy to verify status of
  883.     IME.  But this feature help this.
  884.     This works in the same way when using XIM.
  885.  
  886.     You can select cursor color when status is on by using highlight group
  887.     CursorIM.  For example, add these lines to your _gvimrc: >
  888.  
  889.     if has('multi_byte_ime')
  890.         highlight Cursor guibg=Green guifg=NONE
  891.         highlight CursorIM guibg=Purple guifg=NONE
  892.     endif
  893. <
  894.     Cursor color with off IME is green.  And purple cursor indicates that
  895.     status is on.
  896.  
  897. WHAT IS IME
  898.     IME is a part of East asian version Windows.  That helps you to input
  899.     multibyte character.  English and other language version Windows does not
  900.     have any IME.  (Also there are no need usually.) But there is one that
  901.     called Microsoft Global IME.  Global IME is a part of Internet Exproler
  902.     4.0 or above.  You can get more information about Global IME, at below
  903.     URL.
  904.  
  905. WHAT IS GLOBAL IME                    *global-ime*
  906.     Global IME makes capability to input Chinese, Japanese, and Korean text
  907.     into Vim buffer on any language version of Windows 98, Windows 95, and
  908.     Windows NT 4.0.  Please see below URL for detail of Global IME.  You can
  909.     also find various language version of Global IME at same place.
  910.  
  911.     - Global IME detailed information.
  912.     http://www.microsoft.com/windows/ie/features/ime.asp
  913.  
  914.     - Active Input Method Manager (Global IME)
  915.     http://msdn.microsoft.com/workshop/misc/AIMM/aimm.asp
  916.  
  917.     Support Global IME is a experimental feature.
  918.  
  919. NOTE: For IME to work you must make sure in the "Language settings for the
  920. system" the default locale is set to your language.  The exact location of
  921. this depends on the version of Windows you use.
  922.  
  923. ==============================================================================
  924. 9. Input with a keymap                    *mbyte-keymap*
  925.  
  926. When the keyboard doesn't produce the characters you want to enter in your
  927. text, you can use the 'keymap' option.  This will translate one or more
  928. (English) characters to another (non-English) character.  This only happens
  929. when typing text, not when typing Vim commands.  This avoids having to switch
  930. between two keyboard settings.
  931.  
  932. The value of the 'keymap' option specifies a keymap file to use.  The name of
  933. this file is one of these two:
  934.  
  935.     keymap/{keymap}_{encoding}.vim
  936.     keymap/{keymap}.vim
  937.  
  938. Here {keymap} is the value of the 'keymap' option and {encoding} of the
  939. 'encoding' option.  The file name with the {encoding} included is tried first.
  940.  
  941. 'runtimepath' is used to find these files.  To see an overview of all
  942. available keymap files, use this: >
  943.     :echo globpath(&rtp, "keymap/*.vim")
  944.  
  945. In Insert and Command-line mode you can use CTRL-^ to toggle between using the
  946. keyboard map or not. |i_CTRL-^| |c_CTRL-^|
  947. This flag is remembered for Insert mode with the 'iminsert' option.  When
  948. leaving and entering Insert mode the previous value is used.  The same value
  949. is also used for commands that take a single character argument, like |f| and
  950. |r|.
  951. For Command-line mode the flag is NOT remembered.  You are expected to type an
  952. Ex command first, which is ASCII.
  953. For typing search patterns the 'imsearch' option is used.  It can be set to
  954. use the same value as for 'iminsert'.
  955.  
  956. It is possible to give the GUI cursor another color when the language mappings
  957. are being used.  This is disabled by default, to avoid that the cursor becomes
  958. invisible when you use a non-standard background color.  Here is an example to
  959. use a brightly colored cursor: >
  960.     :highlight Cursor guifg=NONE guibg=Green
  961.     :highlight lCursor guifg=NONE guibg=Cyan
  962. <
  963.             *keymap-file-format* *:loadk* *:loadkeymap* *E105*
  964. The keymap file looks something like this: >
  965.  
  966.     " Maintainer:    name <email@address>
  967.     " Last Changed:    2001 Jan 1
  968.  
  969.     let b:keymap_name = "short"
  970.  
  971.     loadkeymap
  972.     a    A
  973.     b    B    comment
  974.  
  975. The lines starting with a " are comments and will be ignored.  Blank lines are
  976. also ignored.  The lines with the mappings may have a comment after the useful
  977. text.
  978.  
  979. The "b:keymap_name" can be set to a short name, which will be shown in the
  980. status line.  The idea is that this takes less room than the value of
  981. 'keymap', which might be long to distinguish between different languages,
  982. keyboards and encodings.
  983.  
  984. The actual mappings are in the lines below "loadkeymap".  In the example "a"
  985. is mapped to "A" and "b" to "B".  Thus the first item is mapped to the second
  986. item.  This is done for each line, until the end of the file.
  987. These items are exactly the same as what can be used in a |:lnoremap| command.
  988. You can check the result with this command: >
  989.     :lmap
  990. The two items must be separated by white space.  You cannot include white
  991. space inside an item, use the special names "<Tab>" and "<Space>" instead.
  992. The length of the two items together must not exceed 200 bytes.
  993.  
  994. It's possible to have more than one character in the first column.  This works
  995. like a dead key.  Example: >
  996.     'a    รก
  997. Since Vim doesn't know if the next character after a quote is really an "a",
  998. it will wait for the next character.  To be able to insert a single quote,
  999. also add this line: >
  1000.     ''    '
  1001. Since the mapping is defined with |:lnoremap| the resulting quote will not be
  1002. used for the start of another character.
  1003.  
  1004. Although it's possible to have more than one character in the second column,
  1005. this is unusual.  But you can use various ways to specify the character: >
  1006.     A    a        literal character
  1007.     A    <char-97>    decimal value
  1008.     A    <char-0x61>    hexadecimal value
  1009.     A    <char-0141>    octal value
  1010.     x    <Space>        special key name
  1011.  
  1012. The characters are assumed to be encoded for the current value of 'encoding'.
  1013. It's possible to use ":scriptencoding" when all characters are given
  1014. literally.  That doesn't work when using the <char-> construct, because the
  1015. conversion is done on the keymap file, not on the resulting character.
  1016.  
  1017. The lines after "loadkeymap" are interpreted with 'cpoptions' set to "C".
  1018. This means that continuation lines are not used and a backslash has a special
  1019. meaning in the mappings.  Examples: >
  1020.  
  1021.     " a comment line
  1022.     \"    x    maps " to x
  1023.     \\    y    maps \ to y
  1024.  
  1025. If you write a keymap file that will be useful for others, consider submitting
  1026. it to the Vim maintainer for inclusion in the distribution:
  1027. <maintainer@vim.org>
  1028.  
  1029. ==============================================================================
  1030. 10. Using UTF-8                *mbyte-utf8* *UTF-8* *utf-8* *utf8*
  1031.                                 *Unicode*
  1032. The Unicode character set was designed to include all characters from other
  1033. character sets.  Therefore it is possible to write text in any language using
  1034. Unicode (with a few rarely used languages excluded).  And it's mostly possible
  1035. to mix these languages in one file, which is impossible with other encodings.
  1036.  
  1037. Unicode can be encoded in several ways.  The two most popular ones are UCS-2,
  1038. which uses 16-bit words and UTF-8, which uses one or more bytes for each
  1039. character.  Vim can support all of these encodings, but always uses UTF-8
  1040. internally.
  1041.  
  1042. Vim has comprehensive UTF-8 support.  It appears to work in:
  1043. - xterm with utf-8 support enabled
  1044. - Athena, Motif and GTK GUI
  1045. - MS-Windows GUI
  1046.  
  1047. Double-width characters are supported.  This works best with 'guifontwide' or
  1048. 'guifontset'.  When using only 'guifont' the wide characters are drawn in the
  1049. normal width and a space to fill the gap.
  1050.  
  1051. Up to two combining characters can be used.  The combining character is drawn
  1052. on top of the preceding character.  When editing text a composing character is
  1053. mostly considered part of the preceding character.  For example "x" will
  1054. delete a character and its following composing characters by default. If the
  1055. 'delcombine' option is on, then pressing 'x' will delete the combining
  1056. characters, one at a time, then the base character.  But when inserting, you
  1057. type the first character and the following composing characters separately,
  1058. after which they will be joined.  The "r" command will not allow you to type a
  1059. combining character, because it doesn't know one is coming.  Use "R" instead.
  1060.  
  1061. Bytes which are not part of a valid UTF-8 byte sequence are handled like a
  1062. single character and displayed as <xx>, where "xx" is the hex value of the
  1063. byte.
  1064.  
  1065. Overlong sequences are not handled specially and displayed like a valid
  1066. character.  However, search patterns may not match on an overlong sequence.
  1067. (an overlong sequence is where more bytes are used than required for the
  1068. character.)  An exception is NUL (zero) which is displayed as "<00>".
  1069.  
  1070. In the file and buffer the full range of Unicode characters can be used (31
  1071. bits).  However, displaying only works for 16 bit characters, and only for the
  1072. characters present in the selected font.
  1073.  
  1074. Useful commands:
  1075. - "ga" shows the decimal, hexadecimal and octal value of the character under
  1076.   the cursor.  If there are composing characters these are shown too. (if the
  1077.   message is truncated, use ":messages").
  1078. - "g8" shows the bytes used in a UTF-8 character, also the composing
  1079.   characters, as hex numbers.
  1080.  
  1081.  
  1082. STARTING VIM
  1083.  
  1084. If your current locale is in an utf-8 encoding, Vim will automatically start
  1085. in utf-8 mode.
  1086.  
  1087. If you are using another locale: >
  1088.  
  1089.     set encoding=utf-8
  1090.  
  1091. You might also want to select the font used for the menus.  Unfortunately this
  1092. doesn't always work.  See the system specific remarks below, and 'langmenu'.
  1093.  
  1094.  
  1095. USING UTF-8 IN X-Windows                *utf-8-in-xwindows*
  1096.  
  1097. You need to specify a font to be used.  For double-wide characters another
  1098. font is required, which is exactly twice as wide.  There are three ways to do
  1099. this:
  1100.  
  1101. 1. Set 'guifont' and let Vim find a matching 'guifontwide'
  1102. 2. Set 'guifont' and 'guifontwide'
  1103. 3. Set 'guifontset'
  1104.  
  1105. See the documentation for each option for details.  Example: >
  1106.  
  1107.    :set guifont=-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1
  1108.  
  1109. You might also want to set the font used for the menus.  This only works for
  1110. Motif.  Use the ":hi Menu font={fontname}" command for this. |:highlight|
  1111.  
  1112.  
  1113. TYPING UTF-8                        *utf-8-typing*
  1114.  
  1115. If you are using X-Windows, you should find an input method that supports
  1116. utf-8.
  1117.  
  1118. If your system does not provide support for typing utf-8, you can use the
  1119. 'keymap' feature.  This allows writing a keymap file, which defines a utf-8
  1120. character as a sequence of ASCII characters.  See |mbyte-keymap|.
  1121.  
  1122. Another method is to set the current locale to the language you want to use
  1123. and for which you have a XIM available.  Then set 'termencoding' to that
  1124. language and Vim will convert the typed characters to 'encoding' for you.
  1125.  
  1126. If everything else fails, you can type any character as four hex bytes: >
  1127.  
  1128.     CTRL-V u 1234
  1129.  
  1130. "1234" is interpreted as a hex number.  You must type four characters, prepend
  1131. a zero if necessary.
  1132.  
  1133.  
  1134. COMMAND ARGUMENTS                    *utf-8-char-arg*
  1135.  
  1136. Commands like |f|, |F|, |t| and |r| take an argument of one character.  For
  1137. UTF-8 this argument may include one or two composing characters.  These needs
  1138. to be produced together with the base character, Vim doesn't wait for the next
  1139. character to be typed to find out if it is a composing character or not.
  1140. Using 'keymap' or |:lmap| is a nice way to type these characters.
  1141.  
  1142. The commands that search for a character in a line handle composing characters
  1143. as follows.  When searching for a character without a composing character,
  1144. this will find matches in the text with or without composing characters.  When
  1145. searching for a character with a composing character, this will only find
  1146. matches with that composing character.  It was implemented this way, because
  1147. not everybody is able to type a composing character.
  1148.  
  1149.  
  1150. ==============================================================================
  1151. 11. Overview of options                    *mbyte-options*
  1152.  
  1153. These options are relevant for editing multi-byte files.  Check the help in
  1154. options.txt for detailed information.
  1155.  
  1156. 'encoding'    Encoding used for the keyboard and display.  It is also the
  1157.         default encoding for files.
  1158.  
  1159. 'fileencoding'    Encoding of a file.  When it's different from 'encoding'
  1160.         conversion is done when reading or writing the file.
  1161.  
  1162. 'fileencodings'    List of possible encodings of a file.  When opening a file
  1163.         these will be tried and the first one that doesn't cause an
  1164.         error is used for 'fileencoding'
  1165.  
  1166. 'charconvert'    Expression used to convert files from one encoding to another.
  1167.  
  1168. 'formatoptions' The 'm' flag can be included to have formatting break a line
  1169.         at a multibyte character of 256 or higher.  Thus is useful for
  1170.         languages where a sequence of characters can be broken
  1171.         anywhere.
  1172.  
  1173. 'guifontset'    The list of font names used for a multi-byte endoding.  When
  1174.         this option is not empty, it replaces 'guifont'.
  1175.  
  1176. 'keymap'    Specify the name of a keyboard mapping.
  1177.  
  1178. ==============================================================================
  1179.  
  1180. Contributions specifically for the multi-byte features by:
  1181.     Chi-Deok Hwang <hwang@mizi.co.kr>
  1182.     Nam SungHyun <namsh@lge.com>
  1183.     K.Nagano <nagano@atese.advantest.co.jp>
  1184.     Taro Muraoka  <koron@tka.att.ne.jp>
  1185.     Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
  1186.  
  1187.  vim:tw=78:ts=8:ft=help:norl:
  1188.